﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Event.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <style type="text/css">
        .article_relate_header
        {
            color: #000000;
            border-bottom: 1px dotted #CCC;
            width: 98%;
            font-family: Arial, sans-serif;
            font-size: 12px;
            font-weight: bold;
            padding: 0;
            margin: 0;
            float: left;
        }
        .article_relate_name
        {
            float: left;
            width: 90%;
            position: relative;
        }
        .article_relate_name a
        {
            color: #000000;
            background-image: url(/assets/images/nextthmb.png);
            background-repeat: no-repeat;
            background-position: 0 5px;
            font-family: arial;
            font-size: 12px;
            padding: 5px;
            text-decoration: none;
            float: left;
            width: auto;
        }
        .article_relate_name a:hover
        {
            text-decoration: underline;
        }
        .box_popitem
        {
            display: none;
            float: left;
            background-color: #f9f9f9;
            border-radius: 3px;
            position: absolute;
            padding: 10px;
            z-index: 2;
            top: 20px;
            left: 0px;
            border: 1px solid #CCC;
            width: 100%;
        }
        .box_popitemcontent
        {
            float: left;
            width: 100%;
        }
        .box_popitem_title
        {
            float: left;
            width: 100%;
            font-family: Arial, sans-serif;
            font-size: 12px;
            font-weight: bold;
        }
        .box_popitem_summer
        {
            float: left;
            width: 100%;
            font-family: Arial, sans-serif;
            font-size: 11px;
            font-weight: bold;
            text-align: justify;
            line-height: 18px;
            color: #0066FF;
        }
        .doAchive
        {
            background: url(./assets/images/icon-check.png) no-repeat 0px 7px;
            width: 15px;
            min-height: 25px;
            position: relative;
            display: inherit;
        }
    </style>
</head>
<body>
    <div style="float: left; padding: 5px 0 0px 0; width: 98%; height: 90%; overflow: scroll;
        overflow-y: auto; overflow-x: hidden;" class="boxItem">
        <form id="frmevent" runat="server">
        <%if (Request.QueryString["status"] == "-1")
          { %>
        <div class="divhistory" style="height: 15px; width: 100%;">
            <a id="A1" href="cal_events.aspx?tid=4&status=-1&ev=7d" runat="server">7 days</a>
            | <a href="cal_events.aspx?tid=4&status=-1&ev=30d">30 days</a> | <a href="cal_events.aspx?tid=4&status=-1&ev=3m">
                3 months</a> | <a href="cal_events.aspx?tid=4&status=-1">All</a></div>
        <% }%>
        <asp:Repeater runat="server" ID="rpevent">
            <ItemTemplate>
                <div class="event_news" id='event_news_<%#Eval("ID") %>' style='background-color: #<%#Eval("ColorEV")%>;
                    border-bottom: solid 1px #000;'>
                    <%if (Request.QueryString["status"] == null)
                      { %>
                    <div style="z-index: 999; float: left;" class="divdoAchive">
                        <input type="checkbox" id='<%#Eval("ID") %>' class="doAchive" onclick="javascript:doAcchive(this);"
                            <%#  Eval("status").ToString()=="0"?"disabled=\"disabled\" checked=\"checked\"":"" %> />
                        <%--<a class="doAchive" id='<%#Eval("ID") %>' href="#" onclick="javascript:doAcchive(this);"></a>--%>
                    </div>
                    <% }%>
                    <%if (Request.QueryString["Type"] == "2")
                      { %>
                    <%--Note--%>
                    <div style="float: left;" class="article_relate_name">
                        <span class="trigger" style='color: <%#GetTextColor(Eval("ColorEV"))%>; font-weight: bold;
                            font-size: 12px; line-height: 27px;'>
                            <%#HttpUtility.HtmlDecode(Eval("Description").ToString())%>
                        </span>
                    </div>
                    <%}
                      else
                      { %>
                    <div style="float: left;" class="article_relate_name">
                        <span class="trigger" style='color: <%#GetTextColor(Eval("ColorEV"))%>; font-weight: bold;
                            font-size: 12px; line-height: 27px;'>
                            <%if (nSuperPermissions > 0 && Request.QueryString["type"] == "3")
                              { %>
                            Giao việc cho
                            <%#HttpUtility.HtmlDecode(Eval("UserName").ToString()) %>
                            <%}
                              else
                              { %>
                            <%#HttpUtility.HtmlDecode(Eval("Name").ToString()) %>
                            <% }%>
                            <%#GetTimePeriod(Eval("TimeUnit"))%>
                        </span>
                        <div class="box_popitem" title="" lang="" style="opacity: 1; top: 20px; left: 50px;
                            display: block; position: absolute; z-index: 200;">
                            <div class="box_popitemcontent">
                                <div class="box_popitem_title">
                                    <%#  Eval("CustID").ToString() != "-1" ? "C.ty: " : ""%>
                                    <%#loadCustormer(Eval("CustID"))%>
                                    <%--<%#  Eval("CustID").ToString() != "-1" ? "<br/>" : ""%>--%>
                                </div>
                                <div class="box_popitem_summer" title="" lang="">
                                    <%--Từ:
                                    <%#Convert.ToDateTime(Eval("StartDate")).ToString("HH:mm dd-MM-yyyy")%>
                                    đến:
                                    <%#Convert.ToDateTime(Eval("EndDate")).ToString("HH:mm dd-MM-yyyy")%><br />--%>
                                    <b>-
                                        <%#HttpUtility.HtmlDecode(Eval("Name").ToString()) %>
                                        <br />
                                        <%--<%#  Eval("CustID").ToString() != "-1" ? "<u>Kế hoạch đeo đuổi:</u>" : "Ghi chú:"%><br />--%>
                                        -
                                        <%#HttpUtility.HtmlDecode(Eval("Description").ToString()) %>
                                    </b>
                                </div>
                            </div>
                        </div>
                    </div>
                    <%} %>
                    <div class="clear">
                    </div>
                </div>
            </ItemTemplate>
        </asp:Repeater>
        <script type="text/javascript">
            function doAcchive(obj) {
                RemoveEvent(obj);
            }
            function RemoveEvent(obj) {
                //                var vaction = "notified";
                //                if ($("#txtTabID").val() == "2") vaction = "d";
                $.post('./Handlers/Event.ashx?action=archived&id=' + $(obj).attr("id"), function (data) {
                    if (data == "ok") {
                        $("#event_news_" + $(obj).attr("id")).fadeOut(1000);
                        //$("input:checkbox:checked").attr("disabled", true);
                    } else {
                        alert("false");
                    }
                });
            }
            jQuery(document).ready(function ($) {
                $(function () {
                    $('.article_relate_name').each(function () {
                        var distance = 10;
                        var time = 250;
                        var hideDelay = 000;
                        var hideDelayTimer = null;
                        var beingShown = false;
                        var shown = false;
                        var trigger = $('.trigger', this);
                        var info = $('.box_popitem', this).css('opacity', 0);
                        // $([trigger.get(0), info.get(0)]).mouseover(function () {
                        $([trigger.get(0)]).mouseover(function () {
                            if (hideDelayTimer) clearTimeout(hideDelayTimer);
                            if (beingShown || shown) {
                                // don't trigger the animation again
                                return;
                            } else {
                                // reset position of info box
                                beingShown = true;
                                info.css({
                                    top: 30,
                                    left: 0,
                                    display: 'block'
                                }).animate({
                                    top: '-=' + distance + 'px',
                                    opacity: 1
                                }, time, 'swing', function () {
                                    beingShown = false;
                                    shown = true;
                                });
                            }
                            return false;
                        }).mouseout(function () {
                            if (hideDelayTimer) clearTimeout(hideDelayTimer);
                            hideDelayTimer = setTimeout(function () {
                                hideDelayTimer = null;
                                info.animate({
                                    top: '-=' + distance + 'px',
                                    opacity: 0
                                }, time, 'swing', function () {
                                    shown = false;
                                    info.css('display', 'none');
                                });

                            }, hideDelay);

                            return false;
                        });
                    });
                });


            });
        </script>
        </form>
    </div>
    <div class="clear">
    </div>
</body>
</html>
